package com.mq.springcloud.service

import com.mq.springcloud.entity.CommonResult
import com.mq.springcloud.entity.Payment
import org.springframework.cloud.openfeign.FeignClient
import org.springframework.stereotype.Component
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable

@Component
@FeignClient(value = "CLOUD-PROVIDER-SERVICE", fallback = PaymentFeignServiceImpl::class)  //指定调用哪个微服务
interface PaymentFeignService {

    /**
     * 查询
     * @param id
     * @return
     */
    @GetMapping(value = "/payment/get/{id}")    //哪个地址
    fun getPaymentById(@PathVariable("id") id: Long?): CommonResult<Payment>

    /**
     * 暂停几秒方法 超时控制
     * @param
     * @return
     */
    @GetMapping(value = "/payment/feign/timcout")    //哪个地址
    fun paymentFeignTimeout(): String

    //服务超时
    @GetMapping(value = "/payment/feign/paymentInfo_OK/{id}")
    fun paymentInfo_OK(@PathVariable("id") id: Int?): String

    @GetMapping(value = "/payment/feign/paymentInfo_Timeout")
    fun paymentInfo_Timeout(@PathVariable("id") id: Long?): String
}
